package day06;

import sun.management.Agent;
import sun.security.util.Length;

import javax.naming.Name;

//method 方法
public class MethodDemo {
    public static void main(String[] args) {
        /*
        无返回值，无参
        无返回值，有参
        有返回值，无参
        有返回值，有参
         */
//        a();
//        a1("无返回值，有参");
//        int[]a2=b(10);
//        System.out.println("该数组的长度为："+a2.length);
//        System.out.println(a2[0]);
        //int[] a=b(10);
//        int[]b=new int[10];
//        int max = m(10);
//        System.out.println("最大值为：" + max);
        int[] c=new int[5];
        int b=m(c,5);
        System.out.println("最大值为："+b);
        a();a1("hh");

    }

    public static void a() {
        System.out.println("无返回值，无参");
    }

    public static void a1(String a) {
        System.out.println(a);
    }

    public static int[] b(int len) {
        int[] a2 = new int[len];
        for (int i = 0; i < a2.length; i++) {
            a2[i] = (int) (Math.random() * 100);
        }
        return a2;
    }

    public static int m(int[]a,int len) {
        //int[] a=new int[len];
        int max =a[0];
        for (int i = 0; i <len; i++) {
            a[i] = (int) (Math.random() * 1000);
            System.out.println(a[i]);
            if (max <= a[i]) {
                max = a[i];
            }
        }
        return max;

    }
}

